package com.tm.dk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tm.dk.mapper.HistoryMapper;
import com.tm.dk.service.HistoryService;
import com.tm.entity.CompanyEntity;
import com.tm.entity.dto.CompanyDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HistoryServiceImpl extends ServiceImpl<HistoryMapper, CompanyEntity> implements HistoryService {
    @Autowired
    private HistoryMapper historyMapper;

    public Page<CompanyEntity> getpage(CompanyDto companyDto, Page<CompanyEntity> companyEntityPage) {
        QueryWrapper<CompanyEntity> queryWrapper = new QueryWrapper<CompanyEntity>();
        queryWrapper.eq(companyDto.getId() !=null,"c.id",companyDto.getId());
        //2.构造分页查询对象
        Page<CompanyEntity> page = historyMapper.getpage(companyEntityPage, queryWrapper);
        //3.分页条件查询用户信息
        return page;
    }
}
